#include <stdio.h>
void strncpy1(char* dist,const char* src,int n){
  while(n>0&&*src!='\0'){
    *dist=*src;
    dist++;
    src++;
    n--;
  }
  *dist='\0';
}
int main(){
  char buffer[100];
  char* str="my name is yyy";
  strncpy1(buffer,str,30);
  printf("buffer=%s\n",buffer);
  return 0;
}